<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="animate封装的动画函数.js"></script>
    <style>
        .sliderbar {
            position: fixed;
            right: 0;
            bottom: 100px;
            width: 40px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
            color: #fff;
        }
        .con {
            position: absolute;
            left: 0;
            top: 0;
            width: 200px;
            height: 40px;
            background-color: purple;
            z-index: -1;
        }
        .span1{
            display: block;
        }
        .span2{
            display: none;
        }
    </style>
</head>
<body>
    <div class="sliderbar">
        <span class="span1"><--</span>
        <div class="con">问题反馈</div>
    </div>
    <script>
        //1. 获取元素
        var sliderbar = document.querySelector('.sliderbar');
        var con =  document.querySelector('.con');
        var span1 = document.querySelector('.span1');
        var span2 = document.querySelector('.span2');
        //鼠标经过sliderbar 就让con这个盒子滑动到左侧
        //鼠标离开sliderbar 就让con这个盒子滑动到右侧
        sliderbar.addEventListener('mouseenter',function(){
            animate(con,-160,function(){
               sliderbar.children[0].innerHTML = '-->';
            });
        })
        sliderbar.addEventListener('mouseleave',function(){
            animate(con,0,function(){
                sliderbar.children[0].innerHTML = '<--';
            });
        })

    </script>
</body>
</html>